package com.mlatent.mvvmproject.ui.login

import android.app.Application
import androidx.lifecycle.MutableLiveData
import com.lihao.jetpackcore.base.BaseViewModel
import com.lihao.jetpackcore.ext.request
import com.lihao.jetpackcore.state.ResultState
import com.mlatent.mvvmproject.app.network.NetworkApi
import com.mlatent.mvvmproject.data.AppRepository
import com.mlatent.mvvmproject.data.model.UserInfoResponse

/**
 * 登陆
 */
class LoginRegisterViewModel(application: Application) : BaseViewModel(application) {

    var username: String = ""

    var password: String = ""

    val userInfo: MutableLiveData<ResultState<UserInfoResponse>> = MutableLiveData()

    fun login() {
        request({
            NetworkApi.service.login(username, password)
        }, userInfo, true, "登陆中...")
    }
}